package com.ld.wms.exception;

import com.ld.wms.sysenum.ResultResponseEnum;
import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException{

    private static final long serialVersionUID = -7480022450501760611L;

    /**
     * 异常码
     */
    private String code;
    /**
     * 异常提示信息
     */
    private String message;

    private ResultResponseEnum resultResponseEnum;

    public BusinessException(ResultResponseEnum resultResponseEnum) {
        this.resultResponseEnum = resultResponseEnum;
        this.code = resultResponseEnum.getCode();
        this.message = resultResponseEnum.getMessage();
    }


    public BusinessException(String message) {
        this.code = ResultResponseEnum.UNEXPECTED_EXCEPTION.getCode();
        this.message = message;
    }
    // get set方法
    @Override
    public String getMessage() {
       return message;
    }

    public String code() {
        return code;
    }
}
